`use strict`

//显示首页
let index_fn = async (ctx, next) => {
    ctx.render('index2.html');
};

//显示登陆页面
let login_fn = async (ctx, next) => {
    ctx.render('login.html');
};


//显示注册页面
let register_fn = async (ctx, next) => {
    ctx.render('register.html');
};
//处理登录请求


//处理注册请求
let registerDone_fn = async (ctx, next) => {
    //获取从前端传来的数据
    let uid = ctx.request.body.usernmae.trim() || '';
    let pwd = ctx.request.body.password.trim() || '';
    let repwd = ctx.request.body.repassword.trim() || '';

    let res = '';
    if (uid.length > 0 && pwd.length > 0 && pwd == repwd) {

    } else {
        res = { code: 1000, msg: '账号密码不能为空，并且两次密码应该一致' }
    }
}

module.exports = {
    '/': ['get', index_fn],
    '/login': ['get', login_fn],
    '/register': ['get', register_fn],
    '/registerDone':['post',registerDone_fn]
};